package com.imay.live.view;

import android.content.Context;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;

/**
 * Created by Administrator on 2017/07/28 0028.
 */

public class DekaronImageView extends WebpView {
    public DekaronImageView(Context context) {
        super(context);
    }

    public DekaronImageView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public DekaronImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    public DekaronImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int sizeWidth = MeasureSpec.getSize(widthMeasureSpec);
        float childh = sizeWidth * 4 / 3;
        setMeasuredDimension(sizeWidth, (int) MeasureSpec.makeMeasureSpec((int) childh, MeasureSpec.EXACTLY));
    }
}
